<?php

class VanillaShowPeer extends BaseVanillaShowPeer
{
    public static function getNextShows() {
        $c = new Criteria();
        $c->addAscendingOrderByColumn(self::DATE);
        $date = self::doSelectWithI18n($c);

        $today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));

        $risultato = array();

        foreach($date as $data){
            $mese = substr($data->getDate(), 5, 2);
            $giorno = substr($data->getDate(), 8, 2);
            $anno = substr($data->getDate(), 0, 4);

            $secondi = mktime(0, 0, 0, $mese, $giorno, $anno);
            if($secondi >= $today)
                $risultato[] = $data;
        }

        return $risultato;
    }

    public static function getNextShow() {
        $result = self::getNextShows();
        return $result[0];
    }
}
